<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .error{
            color: red;
            font-size: 1pt;
        }
        body{
            background-image: url("https://img.zcool.cn/community/012e285a1ea496a8012171323c6bf1.jpg@1280w_1l_2o_100sh.jpg");
            background-color:white;
            background-size:100% ;
            width:1024px ;
            height:700px;
        }
        #box{
            width: 400px;
            height: 450px;
            border: #fceaff solid;
            background-color:beige;
            position: relative;
            left: 900px;
            top: 50px;
           
        }
      .d2{
           position: absolute;
           left: 90px;
           top: 120px;
           /*border: yellow solid;*/
          font-size: 20px;
        }
        #d1{
            top: 60px;
            position: absolute;
            left: 160px;
            /*border:rebeccapurple solid;*/
        }
        #ti{
            position: absolute;
            left: 120px;
            top: 80px;
        }
        #t{
            position: absolute;
            left: 50px;
            top: 115px;
        }
      </style>
    <script>
      
        // 显示错误消息
        function printError(elemId, hintMsg) {
            document.getElementById(elemId).innerHTML = hintMsg;
        }
        function de() {
            
            var pwd =document.forms["table_1"]["pwd"].value;
            if(pwd=="1234")
            alert("登陆成功"); 
            else
           {
                printError("pwdErr","密码错误");
                return false;
            }
        }
    </script>

</head>
<body>
<div id="box">
    <form id="table_1" onsubmit="return de()" action="file:///D:/%E6%A1%8C%E9%9D%A2/runoob/runoob.html">
   <div id="d1"> <h2 id="font1">欢迎登陆</h2></div>
   <div class="d2">
       <h5>账号：<input type="text" width="500" height="30" id="name1"> <span class="error" id="nameErr"></span></h5>
       <h5>密码：<input type="text"width="50" height="30"  id="pwd"><span class="error" id="pwdErr"></span></h5>
      <div id="ti"> <h2><input type="submit" value="登录" height="80" width="80"/></h2>
          </div>
       <div id="t">   <input type=button value="注册" onclick="javascrtpt:window.location.href='file://D:/%E6%A1%8C%E9%9D%A2/runoob/register.html'" /> </div>

   </div>

 </form>
</div>
</body>
</html>
